#ifndef IMAGEMANAGER_HPP
#define IMAGEMANAGER_HPP

#include "Singleton.hpp"
#include <SFML/Graphics/Image.hpp>
#include <SFML/Graphics/Sprite.hpp>
#include <string>
#include <map>

class ImageManager : public Singleton<ImageManager>
{
    public:

        sf::Sprite sprite(const std::string& strId);

        void release(const std::string& strId);

        void release();

    protected:
    private:
        std::map<std::string, sf::Image*> m_img;

        // for internal use
        sf::Image* find(const std::string& strId) const;
        sf::Image* load(const std::string& strId);

        // for the Singleton
        friend ImageManager* Singleton<ImageManager>::get();
        friend void Singleton<ImageManager>::destroy();
        ImageManager();
        ~ImageManager();
};

// for the user the ImageManager turns out to be a SpriteManager
typedef Singleton<ImageManager> SpriteManager;

#endif // IMAGEMANAGER_H
